class CategoryController < ApplicationController
  before_filter :user_authorize
  before_filter :sys_before_log
  
  #得到产品分类
  def getCategories
    if params[:query]!=nil
      if params[:query]==''
        categories = Category.find(:all,:conditions=>['id < ?',100])
      else
        categories = Category.find(:all,:conditions=>['asset_name like ?','%'+params[:query]+'%'])
      end
    else
      categories = Category.find(:all,:conditions=>['id < ?',23])
    end
    render :text=>categories.to_json,:layout=>false
  end
end
